Repository navigation
fix(studio): a sealed move, resize or turn takes GSAP's route when GSAP animates the layer - #8286
Conversation
…AP animates the layer
…press routed keeps it
… read before choosing CSS
Edit accuracy: accurate 271 (base branch 271), smooth 67 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
eddy-heygen
left a comment
There was a problem hiding this comment.
(Eddy's agent) Reviewed by Eddy's Claude agent at commit 2952e87 (non-test diff read by me, including the commit added after 0616a88).
Verdict: approve.
Summary
In a sealed preview Studio decided "does the animation library own this layer's transform" by asking its own stand-in element, which never has one, so a move, resize or turn of an animated layer was written as plain CSS and then overwritten by the animation. The one routing function now recognises a stand-in and answers from the frame's snapshot of its timelines; the commit paths wait for that snapshot to be read at the playhead before choosing a route.
What I checked
- An element of a live (unsealed) preview takes exactly the old path: the stand-in test is false and the existing check runs.
- For a sealed frame the answer is "a tween writes a transform channel for this target" (transform or box channels for a resize). It errs toward the animation's route, which is the safe side for the bug described.
- The three commit paths (move, resize, rotate) now await the settled answer only when no explicit route was passed; an explicit route still wins.
- The move saved alongside a resize now waits for the same settled answer, so a layer positioned only by a shared tween keeps the animation's route there too.
- The snapshot is dropped and re-read when an undo restores the preview in place, so a route is not chosen from a stale snapshot.
- The separate sealed helper the property panel used is folded into the same function, so the panel and the commit agree.
- No port request is added and nothing from the frame is written anywhere new; the frame's snapshot only picks between two existing write routes.
Non-blockers
- A sealed frame's snapshot cannot say whether the animation actually renders the transform at this moment, only that a tween targets it, so a layer with a transform tween elsewhere on the timeline always takes the animation's route. The code comment says so.
CI: 57 pass, 20 skipped, none failing or pending.
What
In a sealed preview (Studio cannot script the frame), a move, resize or turn of a layer GSAP animates now goes into the animation, as it does in an unsealed preview:
translateon the element on top of the animation, so the animation still drew the layer where it was, and the edit stayed in the file as a hidden offset;width/heightorrotatethe animation overrides.After an undo that the sealed preview restores in place (re-running the page's script), the next of these edits decides its route from the page as it is now. Before, it decided from the tweens read before the undo.
The sealed preview is off by default until the sealed-by-default change (#7846) lands, so nothing changes for anyone before then.
Why
Studio decides once per edit whether GSAP or CSS owns a layer's position, size or turn (
editsPlainCss). It asks the element's own window for its GSAP timelines. In a sealed preview the element is Studio's stand-in, whose window has none, so every layer looked GSAP-free.Studio already reads a sealed frame's GSAP: a snapshot of its timelines over the editing port, matched to stand-ins by handle. The property panel used it through
sealedGsapRendersTransform, but the route decision did not.How
editsPlainCssanswers for a stand-in from the frame's snapshot, with the channel lists the live check uses (position, turn, and for a resize the box channels andscaleX/scaleY). A transform tween stands in for "GSAP renders the transform", which the snapshot does not report.sealedGsapRendersTransformfolds into it: one decision.editsPlainCssSettledreads the snapshot at the playhead before deciding, for a stand-in only; a live element answers at once, as before. The inspector's move and the GSAP-aware move, resize and turn commits use it when no press decided the route.onPreviewRestoredInPlace), as it already did when the preview reloads.A drag still decides at its press, from the frame's own read that a sealed press waits for (
measurePreviewGestureStart, the coregesture-startrequest), not from the snapshot: a move and a resize's anchor take GSAP's route when the frame says GSAP positions the layer (start.gsap), a turn when it says GSAP turns it (start.gsapRotation), and a group move gets each member's answer the same way. The resize commit is handed that answer as its route.A resize drag's release that saves its anchor move on the element, because only a shared tween positions the layer, reads the snapshot too (
useGsapAwareEditing,plainAfterSettle): it now waits for it, as the commits above do. Before, a release before the frame's first snapshot staged a CSS translate on a layer GSAP positions. The press's undo look (readElementLook) asks synchronously, but a stand-in has no GSAP to read either way, so it decides nothing.Test plan
gsapRoute.sealed.test.tsx, with the frame's snapshot served over a mocked port:fails without the fix:
Run on Linux: the new tests pass three runs in a row; Studio's
hooks,components/editor,webmcpandcomponents/sidebartests (4109;hooksandcomponents/editoragain at this head, 3861) and theplayertests (605) pass; Studiotscno errors; format clean; the code audit passes.Bench
Edit-accuracy bench, sealed, the move, resize and turn drags of layers GSAP animates (
fromto,keys,scale) at r0, root, 100% zoom (27), at main and at this change:Accuracy is the same case for case. The two extra failing cases (
move-keys … on,rotate-scale … after) failsmoothonly (frame pacing, reported and not gated; the machine's load was 10 to 16), and every geometry check in them passes on both sides. These are drags, which keep deciding at the press, so no change was expected. The misses on both sides are sealed resize drags ofkeysandscalelayers and move drags ofscalelayers, tracked separately.Before
Sealed preview,
design-panel-qafixture, whose#qa-tween-boxGSAP moves and turns. The agent moves it to 400, 300 (at main). The save wrote a CSStranslateon the element and left the tween alone; the box stays where the animation draws it.After
The same with this change: the move saved into the tween as keyframes, and the box sits at 400, 300 on its motion path.
Each side was run three times on a fresh copy of the fixture with the same result. A first Before run, read once after 3 s with a pattern that missed the reordered attributes, showed the keyframes; its reading is not counted.